//
//  XWVisitorViewController.swift
//  新浪 weibo
//
//  Created by xuwei on 16/1/20.
//  Copyright © 2016年 xuwei. All rights reserved.
//

import UIKit

class XWVisitorViewController: UITableViewController {

    var userLogin:Bool = false
    
    var visitorView:XWVisitorView?
    
    override func loadView() {
        userLogin ? super.loadView():setupVisitorView()
        
    }
    
        private func setupVisitorView(){
            let v = XWVisitorView()
            visitorView = v
            view = v
            
            navigationItem.leftBarButtonItem = UIBarButtonItem(imgNamed: nil, title: "注册", target: self, action: "register")
            navigationItem.rightBarButtonItem = UIBarButtonItem(imgNamed: nil, title: "登陆", target: self, action: "login")
  
            v.registerButton.addTarget(self, action: "register", forControlEvents: UIControlEvents.TouchUpInside)
            v.loginButton.addTarget(self, action: "login", forControlEvents: UIControlEvents.TouchUpInside)
            
        }
    
    
   @objc private func register(){
        print("注册")
    }
    
   @objc private func login(){
        print("登陆")
        presentViewController(XWNavigationController(rootViewController: XWOAuthViewController()), animated: true, completion: nil)
    }
    
    
    
    
    
}
